package com.example.nonggo.model;

import com.example.nonggo.Constants;
import com.example.nonggo.base.BasePresenter;
import com.example.nonggo.base.IBasePresenter;
import com.example.nonggo.contract.HomeContract;
import com.tencent.mmkv.MMKV;

import org.json.JSONObject;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class BaseModel<T extends IBasePresenter> {
    public final String token =  MMKV.defaultMMKV().getString(Constants.ACCESS_TOKEN,"0");
    public   RequestBody getRequestBody(JSONObject jb) {
        return RequestBody.create(MediaType.parse("application/json; charset=utf-8"), jb.toString());
    }
    public T callback;

    public void registerCallBack(T callback) {
        this.callback = callback;
    }

    public void removeRegisterCallBack() {
        this.callback = null;
    }
}
